#include <iostream>
#include <ostream>
#include <queue>
#include <utility>
#include <vector>
using namespace std;
struct cmp
{
	bool operator()(pair<int, int> p1, pair<int, int> p2) // 堆的比较和逻辑相反
	{
		if (p1.first > p2.first)
			return false;
		else if (p1.first == p2.first)
			return p1.second > p2.second;
		else
			return true;
	}
};
#define int long long
signed main()
{
	int n = 0, k = 0;
	cin >> n >> k;
	// vector<int> a(n), b(n);
	priority_queue<pair<int, int>, vector<pair<int, int>>, cmp> qb;
	vector<int> a(n);
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
	}
	int x = 0;
	for (int i = 0; i < n; ++i)
	{
		cin >> x;
		qb.push({ x, a[i] });
	}
	// while(qb.size())
	// {
	// cout << qb.top().first << " " << qb.top().second << endl;
	// qb.pop();
	// }
	// cout << "-------------" << endl;
	int sum1 = 0, sum2 = 0;
	while (qb.size() && k--)
	{
		sum2 += qb.top().first;
		sum1 += qb.top().second;
		qb.pop();
	}
	cout << sum1 << " " << sum2 << endl;
	return 0;
}